<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	protected function _initView()
	{
		//Initialize new view
		$view = new Zend_View();
		$view->doctype("XHTML1_STRICT");
		$view->headTitle("Zend_CMS");
		$view->skin = "skin_1";

		//Add view to viewRenderer
		$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
			'viewRenderer'
		);
		$viewRenderer->setView($view);
		
		//Return the view so that is can be stored by bootstrap
		return $view;
	}
	
	protected function _initNavigation(){
		$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/NavMenu.xml');
		$container = new Zend_Navigation($config);
		$registry = Zend_Registry::getInstance();
		$registry->set('Zend_Navigation', $container);
	}
	
	protected function _initDoctrine(){
		
		$this->getApplication()->getAutoloader()
			->pushAutoloader(array("doctrine", "autoload"));
		spl_autoload_register(array("doctrine","modelsAutoload"));
		
		$doctrineConfig = $this->getOption("doctrine");
		$manager = Doctrine_Manager::getInstance();
		$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
		$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING,Doctrine_Core::MODEL_LOADING_AGGRESSIVE);
		$manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES,true);
		
		Doctrine::loadModels($doctrineConfig['models_path']); 
				
		$conn = Doctrine_Manager::connection($doctrineConfig['dsn'],"doctrine");
		$conn->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
		
		return $conn;
	}
}

